package com.example.netty.nio.zeroCpy.java传统io;

import java.io.DataInputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class OldIOServer {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(7001);

        while (true) {
            Socket socket = serverSocket.accept();
            DataInputStream dataInputStream = new DataInputStream(socket.getInputStream());

            //这里只是为了测试速度，所以数据只读到byte里就不再做进一步的处理
            byte[] bytes = new byte[4096];
            while (true) {
                int readResult = dataInputStream.read(bytes, 0, bytes.length);
                if (readResult == -1) {
                    break;
                }
            }
        }
    }
}



















